//
//  HZOrderByerAddrVCData.m
//  app
//
//  Created by 刘华舟 on 15/5/13.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HZOrderByerAddrVCData.h"

@implementation HZOrderByerAddrVCData

+ (instancetype)dataWithDictionary:(NSDictionary *)dict{
    return [[HZOrderByerAddrVCData alloc] initDataWithDictionary:dict];
}
- (instancetype)initDataWithDictionary:(NSDictionary *)dict{
    if (self = [super init]) {
        
        self.message = [dict stringForKey:APIKEY_mall_msg nilValue:@"数据字段为空"];
        self.timestamp = [dict stringForKey:APIKEY_mall_timestamp nilValue:@"0"];
        
        //地址列表
        NSMutableArray *dataArray = [NSMutableArray array];
        if ([dict arrayForKey:APIKEY_mall_result]) {
            for (NSDictionary *tDict in [dict arrayForKey:APIKEY_mall_result]) {
                HZOrderByerAddressModel *model = [HZOrderByerAddressModel modelWithDictionary:tDict];
                [dataArray addObject:model];
            }
        }
        
        self.addressArray = [NSArray arrayWithArray:dataArray];
        
        
        self.noMoreData = NO;
        if (self.addressArray.count<= 0) {
            self.noMoreData = YES;
        }
    }
    return self;
}

//修改默认收货地址
- (void)switchDefaultAddressWithModel:(HZOrderByerAddressModel *)model{
    
}
//添加默认收货地址
- (void)addDefaultAddressWithModel:(HZOrderByerAddressModel *)model{
    
}

//删除地址
- (void)deleteUserAddressWithModel:(HZOrderByerAddressModel *)model{
    
    NSMutableArray *tempArray = [NSMutableArray arrayWithArray:self.addressArray];
    [tempArray removeObject:model];
    self.addressArray = tempArray;
}

@end
